router.put('/profile', async (req, res) => {
  try {
    const { userId, avatar } = req.body;
    const updatedUser = await User.findOneAndUpdate(
      { userId }, 
      { avatar },
      { new: true }
    );
    
    if (!updatedUser) {
      return res.status(404).json({ message: '用户不存在' });
    }
    
    res.json({ success: true, user: updatedUser });
  } catch (err) {
    res.status(500).json({ message: err.message });
  }
});
